<!--$Id: env_set_timeout.so,v 10.24 2005/05/20 15:07:45 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbEnv::set_timeout</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbEnv::set_timeout</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbEnv::set_timeout(db_timeout_t timeout, u_int32_t flags);
<p>
int
DbEnv::get_timeout(db_timeout_t *timeoutp, u_int32_t flag);
</pre></b>
<hr size=1 noshade>
<b>Description: DbEnv::set_timeout</b>
<p>The DbEnv::set_timeout method sets timeout values for locks or
transactions in the database environment.</p>
<p>All timeouts are checked whenever a thread of control blocks on a lock
or when deadlock detection is performed.  (In the case of
DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly
through the Lock subsystem interfaces.  In the case of
DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a
transaction.  In either case, it may be a lock requested by the database
access methods underlying the application.)  As timeouts are only
checked when the lock request first blocks or when deadlock detection
is performed, the accuracy of the timeout depends on how often deadlock
detection is performed.</p>
<p>Timeout values specified for the database environment may be overridden
on a per-lock or per-transaction basis.  See <a href="../api_cxx/lock_vec.html">DbEnv::lock_vec</a> and
<a href="../api_cxx/txn_set_timeout.html">DbTxn::set_timeout</a> for more information.</p>
<p>The DbEnv::set_timeout method configures a database environment, not only operations
performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
<p>The DbEnv::set_timeout method may be called at any time during the life of the
application.</p>
<p>The DbEnv::set_timeout method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
<br>
<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Set the timeout value for locks in this database environment.
<p>The database environment's lock timeout value may also be configured using the
environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
file is a single line with the string "set_lock_timeout", one or more whitespace
characters, and the lock timeout value.
Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
is opened, it will silently overrule configuration done before that
time.</p></ul>
<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Set the timeout value for transactions in this database environment.
<p>The database environment's transaction timeout value may also be configured using the
environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
file is a single line with the string "set_txn_timeout", one or more whitespace
characters, and the transaction timeout value.
Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
is opened, it will silently overrule configuration done before that
time.</p></ul>
<br>
 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is the timeout value.  It must be specified
as an unsigned 32-bit number of microseconds, limiting the maximum timeout
to roughly 71 minutes.</ul></ul>
<br>
<br><b>Errors</b>
<p>The DbEnv::set_timeout method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<b>Description: DbEnv::get_timeout</b>
<p>The DbEnv::get_timeout method returns a timeout value, in microseconds.</p>
<p>The DbEnv::get_timeout method may be called at any time during the life of the
application.</p>
<p>The DbEnv::get_timeout method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flag</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
<br>
<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Return the timeout value for locks in this database environment.</ul>
<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Return the timeout value for transactions in this database environment.</ul>
<br></ul>
 <b>timeoutp</b><ul compact><li>The <b>timeoutp</b> parameter references memory into which
 the timeout value of the specified <b>flag</b> parameter is copied.</ul> 
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>
<br><b>See Also</b>
<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
